package com.sina.shop.manage.config;

import com.sina.shop.util.Constant;
import com.sina.shop.dao.config.DaoConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.support.ResourceBundleMessageSource;

/**
 * created  on 16/08/2017.
 */
@Configuration
@Import({DaoConfig.class})
@ComponentScan(basePackages = {"com.sina.shop.dao", "com.sina.shop.service"})
public class ServiceConfig {
    @Bean
    public ResourceBundleMessageSource serviceLayerMessageSource() {
        ResourceBundleMessageSource resourceBundleMessageSource = new ResourceBundleMessageSource();
        resourceBundleMessageSource.setDefaultEncoding(Constant.UTF8);
        resourceBundleMessageSource.setBasename("i18n/service/messages");
        resourceBundleMessageSource.setUseCodeAsDefaultMessage(true);
        return resourceBundleMessageSource;
    }
}
